# -*- coding:utf-8 -*-
from flask_script import Command, Option
import os


class BluePrintCommand(Command):
    name = "blue"
    option_list = [
        Option("--name", "-n", help="蓝图名称")
    ]

    def run(self, name=None):
        if name is None:
            print("蓝图名称不能为空！")
            return
        if not os.path.isdir(name):
            os.mkdir(name)
        open("%s/views.py" % name, "w")
        open("%s/models.py" % name, "w")
        with open("%s/urls.py" % name, "w") as f:
            f.write("""from . import views
urlpatterns = [

]            
""")



